package org.hard.test;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
//import com.alibaba.cloud.commons.lang.StringUtils;
import org.hard.entity.FileInfo;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author: 王林博
 * @date: 2023年09月07日 11:26
 */
public class TeStatic {


//    public int countGoodTriplets(int[] arr, int a, int b, int c) {
//        for(int i = 0;arr.length > i;i++){
//            if(0 <= i < ++i < )
//        }
//    }

    public static void main(String[] args) {
        final Date date = new Date();
        System.out.println(date.getTime());
//        Integer matchTime = Math.toIntExact(DateUtil.offsetDay(new DateTime(), -7).getTime() / 1000);
//        System.out.println(matchTime);
        String st = "二五八万万更新了文章，新鲜出炉，火速围观!";
//        final String substring = st.substring(0,Math.min(st.length(), 15));
//        System.out.println(substring);
        System.out.println(st.length());
//        final char[] chars = st.toCharArray();
        final String substring = st.substring(0, Math.min(st.length(), 20));
        System.out.println(substring.length());
        final byte[] bytes = substring.getBytes(StandardCharsets.US_ASCII);
        System.out.println(bytes.length);
//        System.out.println(chars.length);

//        List<FileInfo> infos = new ArrayList<>();
//        FileInfo info = new FileInfo();
//        infos.add(info);
////        info = new FileInfo();
////        infos.add(info);
//        final List<FileInfo> collect = infos.stream().sorted(Comparator.comparing(FileInfo::getFileName).thenComparing(FileInfo::getFileType, Comparator.reverseOrder())).collect(Collectors.toList());
//
//        System.out.println(collect);
//        String str = "点击https://html.caihongsport.com查看";
//        String content = "https://html.caihongsport.com";
//        System.out.println(str.contains(content));
//        System.out.println(DateUtil.currentSeconds());
//        long endTime = DateUtil.offsetMinute(new DateTime(), 30).getTime();
//        System.out.println(endTime);
//        System.out.println(System.currentTimeMillis());
//
//        do {
//            int a = 0;
//            for (int i = 0; i < 10; i++) {
//                if (i == 9){
//                    a = 9;
//                }
//            }
//
//            if(a == 9){
//                System.out.println("1--2");
//                break;
//            }
//            System.out.println("1--1");
//        }while (endTime > System.currentTimeMillis());
//        System.out.println("结束了");
//        List<String> strings = new ArrayList<>();
//
//        for (int i = 0; i < 5; i++) {
//            strings.add(i + 1+"");
//        }
//        final String s = strings.stream().min(String::compareTo).get();
//        String s1 = strings.stream().max(String::compareTo).get();
//        System.out.println(s);
//        System.out.println(s1);
//        Date startTime = DateUtil.parseDate("2023-11-03");
////        Date endTime = DateUtil.parseDate("2023");
//        System.out.println(startTime);
////        System.out.println(endTime);


//        String imageUrl = "http://www.image.caihongsport.com/1696136458444_imageAndroid.png,http://www.image.caihongsport.com/1696136463289_imageAndroid.png,http://www.image.caihongsport.com/1696136469953_imageAndroid.png,http://www.image.caihongsport.com/1696136474536_imageAndroid.png";
//        String imageUrl = "http://www.image.caihongsport.com/1696136458444_imageAndroid.mp4";
//        String[] url = imageUrl.split("/");
//        String mp4Url = url[url.length - 1];
//        if(mp4Url.endsWith(".mp4")){
////            keyList.add(url[url.length-1]);
//            System.out.println(mp4Url);
//        }
//        final DateTime dateTime = DateUtil.parseDateTime("2023-10-26 10:01:08");
//        System.out.println(dateTime);
//        System.out.println(DateUtil.between(DateTime.now(), dateTime , DateUnit.MINUTE) > 24*60);
//        String[] strings = new String[]{"s","s"};
//        System.out.println(strings.length);
//        int i = |-1|;
//        Math.abs()
//        System.out.println();


//        int dish = 3;
//        int[] index = {3, 4, 5};
//        // 进球数判断  ，取最小值和最大值，当同时校验成功 则为校验通过
//        if (index[0] >= dish && index[index.length - 1] >= dish) {
//
//            System.out.println("打球球进球数校验成功");
//        } else if (index[0] <= dish && index[index.length - 1] <= dish) {
//            System.out.println("小球进球数校验成功");
//        } else {
//            System.out.println("进球数校验失败");
//        }
//
//        // 小球时取最大值
//        if (index[index.length - 1] <= dish && 大球时) {
//            System.out.println("小球校验成功");
//        }else if (index[0] >= dish && 小球时) {
//            // 大球时取最小值
//            System.out.println("大球校验成功"); 2023-01-03 02:10:15
//        long time = 16726830155600421L / 10000;
//        System.out.println(time);
//        final DateTime date = DateUtil.date(time);
//        System.out.println(date);
//        System.out.println(date.compareTo(DateUtil.parseDate("2023-01-02 00:00:00")));
//        System.out.println(DateUtil.parseDate("2023-01-02 00:00:00").compareTo(date));
//        }


//        DateTime parse = DateUtil.parse("2023-10-06 10:55:00");
//        long between = DateUtil.between(DateUtil.date(), parse, DateUnit.MINUTE);
//        System.out.println(between);
//
//        List<Integer> integers = new ArrayList<>();
//        for (int i = 0; i < 10; i++) {
//            integers.add(i);
//        }
//        final List<Integer> collect = integers.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
//        System.out.println(collect);
//        System.out.println(parse.compareTo(parse) > 0);
//        System.out.println(DateUtil.year(new Date()));
//        System.out.println(String.valueOf(6 & 1));
//        System.out.println(String.valueOf(5 & 1));
//        System.out.println(65 & 1);
//        String replace = "1,0,0".replaceAll("1", "");
//        System.out.println(replace);
//        System.out.println(replace.length());
//        System.out.println("1,0,0".length() - replace.length());
//        System.out.println(DateUtil.dayOfYear(DateTime.now()));
//        final long between = DateUtil.between(DateTime.now(), DateUtil.parseDate("2022-10-11 15:45:52"),DateUnit.DAY);
//        System.out.println(between);
//        System.out.println(DateUtil.dayOfYear(DateUtil.parseDate("2022-10-11 15:45:52")));
//        TestStatic.execute();
//        TestStatic.execute();

//        for (int i = 0; i < 5; i++) {
//            final long round = Math.round(Math.random() * (10)+2);
//            System.out.println(round);
//        }
//        List<String> strings = new ArrayList<>();
//        strings.add("sdf");
//        strings.add(null);
//        strings.add("ddd");
//        System.out.println(strings.size());
//        System.out.println(JSONUtil.toJsonStr(strings));
//        strings.forEach(avatar ->{
//            avatar = StringUtils.isBlank(avatar) ? "" : avatar;
//        });
//        System.out.println(strings.size());
//        System.out.println(strings.get(1));

    }
}
